package com.muyu.danmo.controller;


import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.muyu.danmo.domain.DanmoInformationMassPhotos;
import com.muyu.danmo.service.IDanmoInformationMassPhotosService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 社团图片idController
 * 
 * @author yangle
 * @date 2024-12-11
 */
@RestController
@RequestMapping("/danmoInformationMassPhotos")
public class DanmoInformationMassPhotosController extends BaseController
{
    @Autowired
    private IDanmoInformationMassPhotosService danmoInformationMassPhotosService;

    /**
     * 查询社团图片id列表
     */
//    @RequiresPermissions("system:danmoInformationMassPhotos:list")
    @GetMapping("/list")
    public Result<TableDataInfo<DanmoInformationMassPhotos>> list(DanmoInformationMassPhotos danmoInformationMassPhotos)
    {
        startPage();
        List<DanmoInformationMassPhotos> list = danmoInformationMassPhotosService.selectDanmoInformationMassPhotosList(danmoInformationMassPhotos);
        return getDataTable(list);
    }

    /**
     * 导出社团图片id列表
     */
//    @RequiresPermissions("system:danmoInformationMassPhotos:export")
    @Log(title = "社团图片id", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DanmoInformationMassPhotos danmoInformationMassPhotos)
    {
        List<DanmoInformationMassPhotos> list = danmoInformationMassPhotosService.selectDanmoInformationMassPhotosList(danmoInformationMassPhotos);
        ExcelUtil<DanmoInformationMassPhotos> util = new ExcelUtil<DanmoInformationMassPhotos>(DanmoInformationMassPhotos.class);
        util.exportExcel(response, list, "社团图片id数据");
    }

    /**
     * 获取社团图片id详细信息
     */
//    @RequiresPermissions("system:danmoInformationMassPhotos:query")
    @GetMapping(value = "/{id}")
    public Result getInfo(@PathVariable("id") Long id)
    {
        return success(danmoInformationMassPhotosService.selectDanmoInformationMassPhotosById(id));
    }

    /**
     * 新增社团图片id
     */
//    @RequiresPermissions("system:danmoInformationMassPhotos:add")
    @Log(title = "社团图片id", businessType = BusinessType.INSERT)
    @PostMapping
    public Result add(@RequestBody DanmoInformationMassPhotos danmoInformationMassPhotos)
    {
        return toAjax(danmoInformationMassPhotosService.insertDanmoInformationMassPhotos(danmoInformationMassPhotos));
    }

    /**
     * 修改社团图片id
     */
//    @RequiresPermissions("system:danmoInformationMassPhotos:edit")
    @Log(title = "社团图片id", businessType = BusinessType.UPDATE)
    @PutMapping
    public Result edit(@RequestBody DanmoInformationMassPhotos danmoInformationMassPhotos)
    {
        return toAjax(danmoInformationMassPhotosService.updateDanmoInformationMassPhotos(danmoInformationMassPhotos));
    }

    /**
     * 删除社团图片id
     */
//    @RequiresPermissions("system:danmoInformationMassPhotos:remove")
    @Log(title = "社团图片id", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public Result remove(@PathVariable Long[] ids)
    {
        return toAjax(danmoInformationMassPhotosService.deleteDanmoInformationMassPhotosByIds(ids));
    }
}
